﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace MotoGame.Estados.Menu
{
    class Menu : EstadoBase
    {
        Botao sair;
        Botao creditos;
        Botao jogar;

        SpriteFont arial;

        public Menu(MainGame game) : base(game)
        {
            arial = Game.Content.Load<SpriteFont>("arial");

            int width = 100;
            int height = 25;
            int screenWidth = Game.Window.ClientBounds.Width;
            int screenHeight = Game.Window.ClientBounds.Height;
            int spacing = 5;

            sair = new Botao(
                Game.GraphicsDevice,
                arial,
                new Rectangle(
                    (screenWidth - width) / 2, (screenHeight - height) / 2 - spacing - height,
                    width, height),
                "Sair",
                (button) => { Game.Exit(); });
            creditos = new Botao(
                Game.GraphicsDevice,
                arial,
                new Rectangle(
                    (screenWidth - width) / 2, (screenHeight - height) / 2,
                    width, height),
                "Créditos",
                (button) => { Game.StateManager.GoTo(MotoGame.MainGame.Estado.Creditos); });
            jogar = new Botao(
                Game.GraphicsDevice,
                arial,
                new Rectangle(
                    (screenWidth - width) / 2, (screenHeight - height) / 2 + spacing + height,
                    width, height),
                "Jogar",
                (button) => { Game.StateManager.GoTo(MotoGame.MainGame.Estado.Jogo); });
        }

        public override void Update(GameTime gameTime)
        {
            sair.Update(gameTime);
            creditos.Update(gameTime);
            jogar.Update(gameTime);
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            sair.Draw(gameTime, spriteBatch);
            creditos.Draw(gameTime, spriteBatch);
            jogar.Draw(gameTime, spriteBatch);
        }
    }
}
